#include<iostream>
#include<string>

using namespace std;


//abcde
//bcade

void todo(string s1,string s2){
    if(s1.size()==1){
        cout<<s1;
        return;
    }
    if(s2.size()>0){
        int temp=s2.find(s1[0]);
        string ls1,ls2,rs1,rs2;
        if(temp!=0){
            ls1=s1.substr(1,temp);
            ls2=s2.substr(0,temp);
        }else if(temp==0){
            ls1="";
            ls2="";
        }
        rs1=s1.substr(temp+1,s1.size()-temp-1);
        rs2=s2.substr(temp+1,s2.size()-temp-1);

        todo(ls1,ls2);
        todo(rs1,rs2);

        cout<<s1[0];
    }


}




int main(){
    string s_pre;
    string s_in;
    cin>>s_pre>>s_in;
    todo(s_pre,s_in);


    return 0;
}
